/**
 * Anderground project - Subway maps processor application.
 * Copyright (C) 2008-2009 Eldar Abusalimov, Ilya Shurigyn
 * 
 * This file is part of Anderground.
 * 
 * Anderground is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 * 
 * Anderground is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Anderground.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.anderground.core.storage;

import java.io.IOException;

/**
 * Signals that an I/O exception of some sort has occurred.
 * <p>
 * The main cause of introducing this class is non-availability of some
 * {@link IOException}'s constructors in JDK1.5.
 * 
 * @author Eldar Abusalimov
 */
public class StorageException extends IOException {

	private static final long serialVersionUID = 4638397458700896268L;

	/**
	 * Constructs an {@code StorageException} with {@code null} as its error
	 * detail message.
	 */
	public StorageException() {
		super();
	}

	/**
	 * Constructs an {@code StorageException} with the specified detail message.
	 * 
	 * @param message
	 *            The detail message (which is saved for later retrieval by the
	 *            {@link #getMessage()} method)
	 */
	public StorageException(String message) {
		super(message);
	}

	/**
	 * Constructs an {@code StorageException} with the specified cause and a
	 * detail message of {@code (cause==null ? null : cause.toString())} (which
	 * typically contains the class and detail message of {@code cause}). This
	 * constructor is useful for IO exceptions that are little more than
	 * wrappers for other throwables.
	 * 
	 * @param cause
	 *            The cause (which is saved for later retrieval by the
	 *            {@link #getCause()} method). (A null value is permitted, and
	 *            indicates that the cause is nonexistent or unknown.)
	 */
	public StorageException(Throwable cause) {
		super(cause == null ? null : cause.toString());
		initCause(cause);
	}

	/**
	 * Constructs an {@code StorageException} with the specified detail message
	 * and cause.
	 * 
	 * <p>
	 * Note that the detail message associated with {@code cause} is <i>not</i>
	 * automatically incorporated into this exception's detail message.
	 * 
	 * @param message
	 *            The detail message (which is saved for later retrieval by the
	 *            {@link #getMessage()} method)
	 * 
	 * @param cause
	 *            The cause (which is saved for later retrieval by the
	 *            {@link #getCause()} method). (A null value is permitted, and
	 *            indicates that the cause is nonexistent or unknown.)
	 */
	public StorageException(String message, Throwable cause) {
		super(message);
		initCause(cause);
	}

}
